home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-27 | 4.9 KB | 188 lines | [TEXT/MPCC] |
- //
- // The Native PCI Driver Support Service Interface
- //
-
- #include "NuDrivers.h"
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Some basic declarations used throughout the support lib interface
- //
-
- typedef void * Ref;
- typedef unsigned long ByteCount;
- typedef unsigned long ItemCount;
- typedef unsigned long OptionBits;
- typedef Ref LogicalAddress;
- typedef Ref PhysicalAddress;
- typedef long OSStatus;
-
- typedef unsigned long IteratorKey;
-
- typedef struct DriverInformation {
- DCtlPtr theDce;
- NuDriverEntryPointPtr theDriverEntryPoint;
- DriverDescription theDescription;
- } DriverInformation, *DriverInformationPtr;
-
- typedef struct NuDriverIterator
- {
- ItemCount totalDrivers;
- ItemCount validDrivers;
- IteratorKey iterationKey;
- DriverInformation theDrivers [1];
- } NuDriverIterator;
-
- enum
- {
- nilOptions = 0
- };
-
- enum
- {
- invalidID = 0
- };
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // IOCommandIsComplete : The replacement for IODone.
- //
- // theID : a unique number given to the driver with each IO request.
- // theResult : the result to be placed in thePB
- //
-
- extern OSErr IOCommandIsComplete ( IOCommandID theID,
- OSErr theResult,
- Boolean dequeueBeforeCompletion );
-
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // PoolAllocateResident : Used to allocate a block of non-pageable memory
- // PoolDeallocate : Used to free an allocated block of memory
- //
- // byteSize : the number of bytes to allocate
- // clear : whether OR not to clear the memory before returning
- // theAddress : the memory to free
- //
-
- extern LogicalAddress PoolAllocateResident ( ByteCount byteSize,
- Boolean clear);
-
- extern OSStatus PoolDeallocate ( LogicalAddress theAddress);
-
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // CallSecondaryInterruptHandler : Used to call a subroutine at SIH-level
- // QueueSecondaryInterruptHandler : Used to queue a subroutine at SIH-level
- //
- // theHandler : the SIH subroutine
- // p1 : the first parameter
- // p2 : the second parameter
- //
-
- typedef OSStatus (*SecondaryInterruptHandler) (Ref p1, Ref p2);
-
- extern OSStatus CallSecondaryInterruptHandler
- (SecondaryInterruptHandler theHandler,
- Ref p1,
- Ref p2);
-
- extern OSStatus QueueSecondaryInterruptHandler
- (SecondaryInterruptHandler theHandler,
- Ref p1,
- Ref p2);
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // LookupDrivers : Used to call a subroutine to be executed at SIH-level
- //
- // theCount : the driver info elements to fill
- // skipCount : the number of driver info elements to skip before filling
- // theDrivers : the driver elements
-
- typedef unsigned short UnitNumber;
-
- extern OSStatus InstallDriver(NuDriverEntryPointPtr theDriverEntryPoint,
- DriverDescriptionPtr theDriverDescription,
- UnitNumber theBeginningUnit,
- UnitNumber theEndingUnit,
- DCtlPtr * theDriver);
-
- extern OSStatus RemoveDriver(DCtlPtr theDriver);
-
- extern OSStatus LookupDrivers(ItemCount theCount,
- ItemCount skipCount,
- NuDriverIterator * theDrivers);
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // PrepareMemoryForIO : Used to setup a memory range for an I/O operation
- // CheckpointIO : Used to undo the setup
- // SynchronizeIO : Perform CPU specific IO space memory operation
- //
- // (See NuKernel ERS)
- //
-
- // For PrepareMemoryForIO and CheckpointIO
-
- typedef Ref AddressSpaceID, IOPreparationID;
-
- enum
- {
- currentAddressSpaceID = 0
- };
-
- typedef OptionBits IOPreparationOptions;
- enum
- {
- ioIsInput = 0x00000001,
- ioIsOutput = 0x00000002,
- ioAddressIsLogical = 0x00000004,
- ioCoherentDataPath = 0x00000008,
- ioTransferIsLogical = 0x00000010
- };
-
- typedef struct LogicalAddressRange
- {
- LogicalAddress theAddress;
- ByteCount theCount;
- } LogicalAddressRange;
-
- typedef struct AddressRange
- {
- PhysicalAddress thePhysicalAddress;
- LogicalAddress theStaticLogicalAddress;
- ByteCount theCount;
- } AddressRange;
-
- typedef struct MappingTable
- {
- AddressSpaceID addressSpace;
- LogicalAddressRange logical;
- ItemCount tableEntryCount;
- AddressRange rangeEntries [1];
- } MappingTable;
-
- typedef OptionBits IOCheckpointOptions;
- enum
- {
- nextIsInput = 0x00000001,
- nextIsOutput = 0x00000002,
- moreTransfers = 0x00000004
- };
-
- extern OSStatus PrepareMemoryForIO (AddressSpaceID theAddressSpace,
- Ref theBase,
- ByteCount theLength,
- IOPreparationOptions theOptions,
- ItemCount theEntryCount,
- MappingTable * theMappingTable,
- IOPreparationID * thePreparationID);
-
- extern OSStatus CheckpointIO (IOPreparationID thePreparationID,
- IOCheckpointOptions theOptions);
-
- extern void SynchronizeIO ();
-